package com.yungu.swift.api.route.v1.common;


import com.alibaba.dubbo.config.annotation.Reference;
import com.yungu.swift.api.base.BaseApi;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.lbs.model.vo.RegeoVo;
import com.yungu.swift.lbs.service.LocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping(value = "/api/v1/location")
@Api(value = "【公共】【地理位置】地理位置相关接口", tags = "地理位置")
public class LocationApi extends BaseApi {

    @Reference
    private LocationService locationService;

    @ApiOperation(value = "逆地理位置编码", notes = "通过坐标获取位置信息")
    @RequestMapping(value = {"/regeo"}, method = {RequestMethod.POST, RequestMethod.GET})
    public ResponseData<RegeoVo> login(
            @ApiParam(name = "appid", value = "APP标识", required = true) @RequestParam String appid,
            @ApiParam(name = "lng", value = "经度", required = true) @RequestParam Double lng,
            @ApiParam(name = "lat", value = "纬度", required = true) @RequestParam Double lat) {
        return locationService.regeo(lng, lat);
    }
}
